package com.ityedao.controller;

import com.ityedao.pojo.Emp;
import com.ityedao.pojo.Result;
import com.ityedao.service.EmpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户登录相关
 */
//@Slf4j
//@RestController
public class Login_Controller {
    @Autowired
    private EmpService empService;

//    @PostMapping("/login")
    public Result login(@RequestBody Emp emp){ // 1、接收并封装参数
        // 2、调用service方法进行登录
        Emp e = empService.login(emp);
        System.out.println(e);
        // 3、响应
        return e != null ? Result.success() : Result.error("用户名或密码错误");
    }

}
